//
//  LBNetworkReachability.h
//  LBNetworking
//
//  Created by WuShiHai on 19/5/30.
//  Copyright (c) 2019 Lebbay. All rights reserved.
//

#import <Foundation/Foundation.h>

#import <AFNetworking/AFNetworking.h>

typedef void(^LBNetworkReachabilityBlock)();

extern NSString * const LBNetworkReachabilityChageNotification;

@interface LBNetworkReachability : NSObject

/**
 开启网络监测，网络状态变化均会LBNetworkReachabilityChageNotification通知

 @param checkURLString 用于监测的地址
 */
+ (void)startMonitor:(NSString *)checkURLString;

/**
 开启网络监测，使用block进行回调，通知也会发送

 @param checkURLString 用于监测的地址
 @param viaWWANBlock 切换到移动网的回调
 @param viaWiFiBlock 切换到有线网的回调
 @param notReachableBlock 网络无连接的回调
 */
+ (void)startMonitor:(NSString *)checkURLString
             viaWWAN:(LBNetworkReachabilityBlock)viaWWANBlock
             viaWiFi:(LBNetworkReachabilityBlock)viaWiFiBlock
        notReachable:(LBNetworkReachabilityBlock)notReachableBlock;

/**
 获取当前的网络状态

 @return 网络状态
 */
+ (AFNetworkReachabilityStatus)status;

/**
 判断网络是否可达

 @return YES or NO
 */
+ (BOOL)isReachable;

@end
